<?php
class View extends Smarty
{
	public $extension = '.php';
	public $exibeLayout = true;
	
	public function __construct()
	{
		$this->allow_php_templates = true;
        $this->force_compile = true;
        $this->template_dir = APPLICATION_PATH . '/modules/'. ControleURI::getModule() .'/view/';
        $this->compile_dir  = APPLICATION_PATH . '/cache/';
        return $this;
	}
	
	public function getView($view)
	{
		if($this->templateExists($view.$this->extension))
		{
			return Util::compacto($this->fetch('php:'.$view.$this->extension));
		}
		else 
			throw new Exception('Não existe o template ' , $view.$this->extension);
	}
}